var url = null;

/**
 * 查询
 */
function query() {
	if ($("#userName_query").val().length > 0) {
		$('#dgAward').datagrid({
			url : getHttpRequestPath("record/queryDrawInfoList"),
			queryParams : {
				userName : $("#userName_query").val()
			}
		});
		$('#dg').datagrid({
			url : getHttpRequestPath("record/queryDrawRecordList"),
			pageNumber : 1,
			queryParams : {
				userName : $("#userName_query").val()
			}
		});
	} else {
		$.messager.alert('系统提示', '用户名不能为空!');
	}
}

var formatDateStr = "yyyy-MM-dd hh:mm:ss";
function formatDate(val, row, index) {
	var str = "";
	str += new Date(row.drawDate).format(formatDateStr);
	return str;
}

function formatCount(val, row, index) {
	var str = "";
	str += row.patchCount + " / " + row.needCount;
	return str;
}

function formatAction(val, row, index) {
	var str = "";
	str += createLinkElement('兑奖', 'recAward(\'' + row.userId + '\', \'' + row.awardName + '\', \'' + row.patchCount + '\', \'' + row.needCount + '\')', 'icon-print');
	return str;
}